<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>登陆</title>
<link rel="shortcut icon" href="/pic/pix/Hospital.jpg"> <!-- 这是页面的标题图标，可更换自己需要的icon-->
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrapStyle/css/bootstrap.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrapStyle/css/bootstrap-overrides.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/font-awesome/4.2.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/fonts/fonts.googleapis.com.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/ace.min.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/bootstrap/css/ace-rtl.min.css" />
<link href="${pageContext.request.contextPath}/bootstrap/css/signin.css" rel="stylesheet">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrapStyle/css/bundled.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/bootstrapStyle/css/jquery-confirm.css"/>

</head>
<body class="login-layout">
		<div class="main-container">
			<div class="main-content">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1">
						<div class="login-container">
							<br/><br/><br/>
							<div align="center">
								<h1 style="font-size: 38px;color:#FFFFFF">速递医运</h1>
							</div>
							<br/><br/>
							<div class="position-relative">
								<div id="login-box" class="login-box visible widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header blue lighter bigger">
												<i class="ace-icon fa fa-coffee green"></i>
												用户登录
											</h4>
											<div class="space-6"></div>
											<form method="post" id="LoginSubmit">
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" id="hosploginphoneL" class="form-control" placeholder="注册手机号" style="height:35px;" required/>
															<i class="ace-icon fa fa-user"></i>
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" id="hosploginpwdL" class="form-control" placeholder="密码"style="height:35px;margin-top:16px" required/>
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>
													<div class="space"></div>

													<div class="clearfix">
														<label class="inline">
															<input type="checkbox" class="ace" id="LoginRemenber"/>
															<span class="lbl"> 记住</span>
														</label>

														<button type="button" class="width-100 pull-right btn btn-sm btn-primary" id="LoginBtn" onclick="LoginSubmit()">
															<i class="ace-icon fa fa-key"></i>
															<span class="bigger-110">登录</span>
														</button>
													</div>

													<div class="space-4"></div>
												</fieldset>
											</form>
										</div><!-- /.widget-main -->

										<div class="toolbar clearfix">
											<div>
												<a href="#" data-target="#forgot-box" class="forgot-password-link">
												<i class="ace-icon fa fa-arrow-left"></i>
													忘记密码?
												</a>
											</div>
											<div>
												<a href="#" data-target="#signup-box" class="user-signup-link">
													注册
													<i class="ace-icon fa fa-arrow-right"></i>
												</a>
											</div>
										</div>
									</div>
								</div>

								<div id="forgot-box" class="forgot-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header red lighter bigger">
												<i class="ace-icon fa fa-key"></i>
												找回密码
											</h4>
											<div class="space-6"></div>
											<p>输入您的手机号码</p>
											<form>
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" id="hosploginphoneF" class="form-control" placeholder="手机号码" required/>
															<i class="ace-icon fa fa-phone"></i>
														</span>
													</label>

													<div class="clearfix">
														<input type="text" id="codeF" class="width-60 pull-left form-control" placeholder="验证码" required/>
														<input type="button" class="width-35 pull-right btn btn-sm btn-danger" value="获取验证码" onclick="SendCodeF()" id="btnSendCodeF"/>
													</div>
													<div class="space-6"></div>
													<p>输入您的新密码</p>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" id="hosploginpwdF" class="form-control" placeholder="新密码" required/>
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>
													<label class="block clearfix">
														<button type="button" class="width-100 pull-right btn btn-sm btn-danger" id="ForgiveBtn" style="height:35px;margin-top: 15px;" onclick="forgivePwd()">
															<span class="bigger-110">提交</span>
														</button>
													</label>
												</fieldset>
											</form>
										</div>

										<div class="toolbar center">
											<a href="#" data-target="#login-box" class="back-to-login-link">
												返回登录
												<i class="ace-icon fa fa-arrow-right"></i>
											</a>
										</div>
									</div>
								</div>
								
								<div id="signup-box" class="signup-box widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header green lighter bigger">
												<i class="ace-icon fa fa-users blue"></i>
												用户注册
											</h4>
											<div class="space-6"></div>
											<p>填写信息: </p>
											<form id="ZhuCe" method="post">
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" id="hosploginphoneR" class="form-control" placeholder="注册手机" style="height:35px;margin-top:16px" required/>
															<i class="ace-icon fa fa-phone"></i>
														</span>
													</label> 
													<div class="clearfix">
														<input type="text" class="width-60 pull-left form-control" placeholder="验证码" id="codeR" style="height:35px;margin-top:16px" required/>
														<input type="button" id="btnSendCodeR" class="width-35 pull-right btn btn-sm btn-success" style="height:35px;margin-top:16px" value="获取验证码" onclick="SendCodeR()">
															
													</div>
													
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" id="hosploginpwdR" class="form-control" placeholder="密码" style="height:35px;margin-top:16px" required/>
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>
													
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" id="hosploginpwdR2" class="form-control" placeholder="再输一次密码" style="height:35px;margin-top:16px" required/>
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>
													<label class="block">
														<input type="checkbox" id="acceeptR" value="1" class="ace" style="margin-top:16px" required/>
														<span class="lbl" style="margin-top:16px">
															接受
															<a href="#">用户协议</a>
														</span>
													</label>

													<div class="space-24"></div>

													<div class="clearfix">
														<button type="reset" class="width-30 pull-left btn btn-sm">
															<span class="bigger-110">重置</span>
														</button>

														<button type="button" class="width-65 pull-right btn btn-sm btn-success" id="registerBtn" onclick="register()">
															<span class="bigger-110">注册</span>
														</button>
													</div>
												</fieldset>
											</form>
										</div>

										<div class="toolbar center">
											<a href="#" data-target="#login-box" class="back-to-login-link">
												<i class="ace-icon fa fa-arrow-left"></i>
												返回登录
											</a>
										</div>
									</div>
								</div>
							</div>

							<div class="navbar-fixed-top align-right">
								<br />
								&nbsp;
								<a id="btn-login-dark" href="#">纯黑</a>
								&nbsp;
								<span class="blue">/</span>
								&nbsp;
								<a id="btn-login-blur" href="#">炫蓝</a>
								&nbsp;
								<span class="blue">/</span>
								&nbsp;
								<a id="btn-login-light" href="#">亮白</a>
								&nbsp; &nbsp; &nbsp;
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="${pageContext.request.contextPath }/bootstrapStyle/js/bundled.js"></script>
    	<script src="${pageContext.request.contextPath }/bootstrapStyle/js/jquery-confirm.js"></script>
		<script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.min.js"></script>
		<script src="${pageContext.request.contextPath }/bootstrapStyle/js/theme.js"></script>
		<script type="text/javascript">
			window.jQuery || document.write("<script src='${pageContext.request.contextPath}/bootstrap/js/jquery.min.js'>"+"<"+"/script>");
		</script>
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='${pageContext.request.contextPath}/bootstrap/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script type="text/javascript">
			jQuery(function($) {
			 $(document).on('click', '.toolbar a[data-target]', function(e) {
				e.preventDefault();
				var target = $(this).data('target');
				$('.widget-box.visible').removeClass('visible');//hide others
				$(target).addClass('visible');//show target
			 });
			});
			//you don't need this, just used for changing background
			jQuery(function($) {
				$('#btn-login-dark').on('click', function(e) {
					$('body').attr('class', 'login-layout');
					$('#id-text2').attr('class', 'white');
					$('#id-company-text').attr('class', 'blue');
					e.preventDefault();
			 	});
			 	$('#btn-login-light').on('click', function(e) {
					$('body').attr('class', 'login-layout light-login');
					$('#id-text2').attr('class', 'grey');
					$('#id-company-text').attr('class', 'blue');
					e.preventDefault();
			 	});
				$('#btn-login-blur').on('click', function(e) {
					$('body').attr('class', 'login-layout blur-login');
					$('#id-text2').attr('class', 'white');
					$('#id-company-text').attr('class', 'light-blue');
					e.preventDefault();
			 	});
		});
		</script>
		
	<script type="text/javascript">
		var InterValObjR; //timer变量，控制时间
		var countR = 5; //间隔函数，1秒执行
		var curCountR;//当前剩余秒数
		function SendCodeR(){
			var hosploginphone=$("#hosploginphoneR").val();
			if(hosploginphone==""){
				$.alert("手机号码不可为空！");
				return false;
			}
			curCountR = countR;
			//设置button效果，开始计时
			$("#btnSendCodeR").attr("disabled", "true");
			$("#btnSendCodeR").val("获取验证码 (" + curCountR + ")");
	   		InterValObjR = window.setInterval(SetRemainTimeR, 1000); //启动计时器，1秒执行一次
			$.ajax({
	    		type:"post",
	    		url:"${pageContext.request.contextPath}/Login/SendPhoneCodeR.action",
	    		async: true,
	            data:"hosploginphone="+hosploginphone,
	           	success:function(data){
	           		if(data.code!=100){
	           			$.alert(data.msg);
	           			window.clearInterval(InterValObjR);//停止计时器
	    				$("#btnSendCodeR").removeAttr("disabled");//启用按钮
	    				$("#btnSendCodeR").val("获取验证码");
	           		}
	           	},error:function(request){
	           		$.alert("请求出错了！");
	           		window.clearInterval(InterValObjR);//停止计时器
					$("#btnSendCodeR").removeAttr("disabled");//启用按钮
					$("#btnSendCodeR").val("获取验证码");
	           	}
	    	})
		}
		//timer处理函数
		function SetRemainTimeR() {
			if (curCountR == 0) {                
				window.clearInterval(InterValObjR);//停止计时器
				$("#btnSendCodeR").removeAttr("disabled");//启用按钮
				$("#btnSendCodeR").val("获取验证码");
			}else {
				curCountR--;
				$("#btnSendCodeR").val("获取验证码 (" + curCountR + ")");
			}
		}
		//简单注册
		function register(){
			var hosploginphone=$('#hosploginphoneR').val();
			var hosploginpwd=$('#hosploginpwdR').val();
			var hosploginpwd2=$('#hosploginpwdR2').val();
			var code=$('#codeR').val();
			if(hosploginphone=="" || hosploginpwd=="" || hosploginpwd2=="" || code==""){
				$.alert("信息请填写完整！");
				return false;
			}
			if(hosploginpwd!=hosploginpwd2){
				$.alert("新旧密码不一致！");
				return false;
			}
			if(!$("#acceeptR").is(":checked")){
				$.alert("请接受用户协议！");
				return false;
			}
			$("#registerBtn").html('<span class="bigger-110">注册中...</span>');
			$('#registerBtn').prop('disabled',true);
			$.ajax({
				type:"post",
				url:"${pageContext.request.contextPath}/Login/register.action",
				async: true,
				data:"hosploginphone="+hosploginphone+"&hosploginpwd="+hosploginpwd2+"&code="+code,
				success:function(data){
					if(data.code==100){
						$.confirm({
        					title: '提示!',
                		    content: '注册成功！',
                		    type: 'green',
                		    typeAnimated: true,
                		    buttons: {
                		    	确定: function (){window.location.href="${pageContext.request.contextPath}/Login/login.action";}
                		    }
        				})
					}else{
						$.alert(data.msg);
						$("#registerBtn").html('<span class="bigger-110">注册</span>');
						$('#registerBtn').prop('disabled',false);
					}
				},error:function(data){
					$("#registerBtn").html('<span class="bigger-110">注册</span>');
					$('#registerBtn').prop('disabled',false);
					$.alert("请求路径出错！");
				}
			});
		}
	</script>
	
	<script type="text/javascript">
		function LoginSubmit(){
			var hosploginphone = $('#hosploginphoneL').val();
			var hosploginpwd = $('#hosploginpwdL').val();
			if(hosploginphone=="" || hosploginphone==""){
				$.alert("用户名密码不可为空！！");
				return false;
			}
			$("#LoginBtn").html('<i class="ace-icon fa fa-key"></i><span class="bigger-110"> 登录中...</span>');
			$('#LoginBtn').prop('disabled',true);
			$.ajax({
				type:"post",
				url:"${pageContext.request.contextPath}/Login/loginsubmit.action",
				async: true,
				data:"hosploginphone="+hosploginphone+"&hosploginpwd="+hosploginpwd,
				success:function(data){
					if(data.code==100){
						window.location.href="${pageContext.request.contextPath}/Main/pageindex.action";
					}else{
						$.alert(data.msg);
						$("#LoginBtn").html('<i class="ace-icon fa fa-key"></i><span class="bigger-110"> 登录</span>');
						$('#LoginBtn').prop('disabled',false);
					}
				},error:function(data){
					$.confirm({
	    				title: 'error',
	            		content: '请求路径错误！！',
	            		type: 'orange',
	            		typeAnimated: true,
	            		buttons: {
	            			确定: function () {
	            		    	$("#LoginBtn").html('<i class="ace-icon fa fa-key"></i><span class="bigger-110"> 登录</span>');
	            		    	$('#LoginBtn').prop('disabled',false);
	            			}
	            		}
	    			})
				}
			});
		}
	</script>
	
	<script type="text/javascript">
		var InterValObjF; //timer变量，控制时间
		var countF = 60; //间隔函数，1秒执行
		var curCountF;//当前剩余秒数
		function SendCodeF(){
			var hosploginphone=$("#hosploginphoneF").val();
			if(hosploginphone==""){
				$.alert("手机号码不可为空！");
				return false;
			}
			curCountF = countF;
			//设置button效果，开始计时
			$("#btnSendCodeF").attr("disabled", "true");
			$("#btnSendCodeF").val("获取验证码 (" + curCountF + ")");
       		InterValObjF = window.setInterval(SetRemainTimeF, 1000); //启动计时器，1秒执行一次
			$.ajax({
        		type:"post",
        		url:"${pageContext.request.contextPath}/Login/SendPhoneCodeF.action",
        		async: true,
                data:"hosploginphone="+hosploginphone,
               	success:function(data){
               		if(data.code!=100){
               			$.alert(data.msg);
               			window.clearInterval(InterValObjF);//停止计时器
        				$("#btnSendCodeF").removeAttr("disabled");//启用按钮
        				$("#btnSendCodeF").val("获取验证码");
               		}
               	},error:function(request){
               		window.clearInterval(InterValObjF);//停止计时器
    				$("#btnSendCodeF").removeAttr("disabled");//启用按钮
    				$("#btnSendCodeF").val("获取验证码");
               		$.alert("请求出错了！");
               	}
        	})
		}
		//timer处理函数
		function SetRemainTimeF() {
			if (curCountF == 0) {                
				window.clearInterval(InterValObjF);//停止计时器
				$("#btnSendCodeF").removeAttr("disabled");//启用按钮
				$("#btnSendCodeF").val("获取验证码");
			}else {
				curCountF--;
				$("#btnSendCodeF").val("获取验证码 (" + curCountF + ")");
			}
		}
		//忘记密码页提交事件，修改密码
		function forgivePwd(){
			var hosploginphone=$("#hosploginphoneF").val();
			var hosploginpwd=$("#hosploginpwdF").val();
			var code=$("#codeF").val();
			if(hosploginphone=="" || hosploginpwd=="" || code==""){
				$.alert("请将信息填写完整！");
				return false;
			}
			$("#ForgiveBtn").html('<span class="bigger-110"> 修改中...</span>');
			$('#ForgiveBtn').prop('disabled',true);
			$.ajax({
        		type:"post",
        		url:"${pageContext.request.contextPath}/Login/forgivePWD.action",
        		async: true,
                data:"hosploginphone="+hosploginphone+"&hosploginpwd="+hosploginpwd+"&code="+code,
               	success:function(data){
               		$.alert(data.msg);
               		$("#ForgiveBtn").html('<span class="bigger-110"> 提交</span>');
    		    	$('#ForgiveBtn').prop('disabled',false);
               		if(data.code==100){
               			window.location.href="${pageContext.request.contextPath}/Login/login.action";
               		}
               	},error:function(request){
               		$("#ForgiveBtn").html('<span class="bigger-110"> 提交</span>');
    		    	$('#ForgiveBtn').prop('disabled',false);
               		$.alert("请求出错了！");
               	}
        	})
		}
	</script>
</body>
</html>